//
//  AppDelegate.m
//  YouGoWeGo
//
//  Created by LiuFei on 14/11/19.
//  Copyright (c) 2014年 LiuFei. All rights reserved.
//

#import "AppDelegate.h"

#import "TripViewController.h"
#import "NavigationViewController.h"


@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
//    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//    [self.window setBackgroundColor:[UIColor whiteColor]];
//    [self.window makeKeyAndVisible];
//    [self.window release];
//    
//    AreaViewController *area = [[AreaViewController alloc] init];
//    UINavigationController *aNav = [[UINavigationController alloc] initWithRootViewController:area];
//    area.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"景点" image:[UIImage imageNamed:@"1.png"] selectedImage:nil];
//    
//    TripViewController *trip = [[TripViewController alloc] init];
//    UINavigationController *tNav = [[UINavigationController alloc] initWithRootViewController:trip];
//    trip.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"游记" image:[UIImage imageNamed:@"1.png"] selectedImage:nil];
//    
//    SaleViewController *sale = [[SaleViewController alloc] init];
//    UINavigationController *sNav = [[UINavigationController alloc] initWithRootViewController:sale];
//    sale.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"特价" image:[UIImage imageNamed:@"1.png"] selectedImage:nil];
//    
//    MineViewController *mine = [[MineViewController alloc] init];
//    UINavigationController *mNav = [[UINavigationController alloc] initWithRootViewController:mine];
//    mine.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"1.png"] selectedImage:nil];
//    
//    NSArray *arr = [NSArray arrayWithObjects:tNav, aNav, sNav, mNav, nil];
//    UITabBarController *tab = [[UITabBarController alloc] init];
//    [tab setViewControllers:arr];
//    [self.window setRootViewController:tab];
    
    
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
//    self.image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"2.png"]];
//    [_image setFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
//    [self.window addSubview:_image];
//    [_image release];
    
//    self.window.backgroundColor = [UIColor whiteColor];
    [self.window setBackgroundColor:[UIColor whiteColor]];
    [self.window makeKeyAndVisible];
    
    // 引导动画
//    [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(menu) userInfo:nil repeats:NO];
    
    
    self.window.rootViewController = [[[NavigationViewController alloc] initWithRootViewController:[[[TripViewController alloc] init] autorelease]] autorelease];

    
    [self.window release];
    return YES;
}

- (void)menu
{
    [UIView beginAnimations:@"kk" context:nil];
    [UIView setAnimationDuration:1];
    [UIView setAnimationRepeatCount:1];
    [_image setFrame:CGRectMake(- 375, 0, 375, 667)];
    
//    self.window.rootViewController = [[[NavigationViewController alloc] initWithRootViewController:[[[TripViewController alloc] init] autorelease]] autorelease];
    
    [UIView commitAnimations];

    
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
